# coding: utf-8

from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker

from SakyaConfig import get

_SECTION = 'sakya.db'
_DB_URL = "mysql://"
_DB_URL += get(_SECTION,'username')
_DB_URL += ':' + get(_SECTION,'password')
_DB_URL += '@' + get(_SECTION,'server')
_DB_URL += ':' + get(_SECTION,'port')
_DB_URL += '/' + get(_SECTION,'db')
_DB_URL += '?charset=utf8'

engine = create_engine(_DB_URL, encoding='utf-8', echo=True, pool_recycle=60)
#engine = create_engine('mysql://zhuxuezheng:zhuxuezheng@localhost/sakya?charset=utf8',encoding='utf-8',echo=True,pool_recycle=60)
sessionFac = sessionmaker(bind=engine, autocommit=True, autoflush=True)
